#include "keyinput.h"
#include <iostream>

using namespace std;

KeyInput::KeyInput()
{
    this->despX = 0;
    this->despY = 0;
}

void KeyInput::run()
{
    int key;
    while(true)
    {
        key = cin.get();
        cout << key << endl;

        switch(key)
        {
            case 119:
                this->despY = 100;break;
            case 115:
                this->despY = -100;break;
            case 97:
                this->despX = -100;break;
            case 100:
                this->despX = 100;break;
        }
    }
}

int* KeyInput::desplazamiento()
{
    this->desp[0] = this->despX;
    this->desp[1] = this->despY;
    this->despX = 0;
    this->despY = 0;

    return this->desp;
}
